import httpInstance from "@/utils/http.js";
// 查询地址列表
export const queryAddressBookList = () => {
    return httpInstance({
        url: '/user/addressBook/list',
        method: 'GET',
    })
}

// 新增默认接口
export const putAddressBookDefault = (params) => {
    return httpInstance({
        url: '/user/addressBook/default',
        method: 'PUT',
        data: params
    })
}


// 新增地址接口
export const addAddressBook = (params) => {
    return httpInstance({
        url: '/user/addressBook',
        method: 'POST',
        data:params
    })
}

// 修改地址接口
export const editAddressBook = (params) => {
    return httpInstance({
        url: '/user/addressBook',
        method: 'PUT',
        data:params
    })
}

// 删除地址
export const delAddressBook = (id) => {
    return httpInstance({
        url: `/user/addressBook/?id=${id}`,
        method: 'DELETE',
        params: { id }
    })
}

// 查询地址通过id
export const queryAddressBookById = (params) => {
    return httpInstance({
        url: `/user/addressBook/${params.id}`,
        method: 'GET',
        params
    })
}
// 查询默认地址
export const getAddressBookDefault = () => {
    return httpInstance({
        url: '/user/addressBook/default',
        method: 'GET'
    })
}